package handler;

import my.netty.channel.handler.AbstractChannelHandlerContext;
import my.netty.channel.handler.SimpleChannelInboundHandler;

import java.io.IOException;
import java.nio.ByteBuffer;

public class WriteMsgHandler extends SimpleChannelInboundHandler {
    @Override
    protected <I> void channelRead0(AbstractChannelHandlerContext ctx, I msg) {

        try {
            ctx.pipeline().writeAndFlush(ByteBuffer.wrap("服务端发送成功了".getBytes()));
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
}
